use crate::tasks::data_task;
use crate::utils::{Message, ServerConfig};
use tauri::AppHandle;

pub fn create_message_queue_server_config(app_handle: AppHandle) -> ServerConfig {
    let mut config = ServerConfig::new(4); // 4 个线程

    // 添加消息处理函数
    config.add_handler(move |message| match message {
        Message::Start => {
            println!("Server: Received Start message");
            println!("Server: Executing Start Task...");
        }
        Message::Data(value) => data_task(value, app_handle.clone()),
        Message::Stop => {
            println!("Server: Received Stop message");
            println!("Server: Executing Stop Task...");
        }
    });
    config
}
